import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text("icon_button"),
          ),
          body: Center(
            child: Column(
              children: <Widget>[
                Icon(Icons.person),
                SizedBox(
                  height: 10,
                ),
                IconButton(icon: Icon(Icons.error), onPressed: (){
                  showToast();
                },),
                RaisedButton(
                  onPressed: showToast,
                  child: Text("RaisedButton"),
                )

              ],
            ),
          )),
    );
  }

  void showToast() {
    Fluttertoast.showToast(
      msg: "onPressed IconButton",
      toastLength: Toast.LENGTH_SHORT,
    );
  }
}
